package com.itheima.demo;

public class DaAn {
    public static void main(String[] args) {
        int month = 10;
        int num = fibonacci(month);
        System.out.println("第" + month + "个月兔子对数是：" + num);
    }

    public static int fibonacci(int month) {
        if (month < 1) {
            return 0;
        }
        int[] arr = new int[month];
          arr[0] = 1;
        arr[1] = 1;
        for (int i = 2; i < arr.length; i++) {
            arr[i] = arr[i - 1] + arr[i - 2];
        }
        return arr[arr.length - 1];
    }

}

